package com.vkserver.server;

import com.vkserver.services.DBManager;
import com.vkserver.services.DocumentProcessor;
import com.vkserver.services.utils.User;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.List;

/**
 *@author roman.prudkogliad@gmail.com
 */

@Path("/user/{userId}/{sex}/{name}")
public class UserResource {

    DocumentProcessor documentProcessor = new DocumentProcessor();

    @GET
	@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
	public List<User> getContacts() {
		List<User> contacts = new ArrayList<User>();
		//contacts.addAll( ContactStore.getStore().values() );
		return contacts;
	}




    @GET
    @Path("/{userId}/{sex}/{name}")
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public User getUser(@PathParam("userId") long userId,
                          @PathParam("sex") int sex,
                          @PathParam("name") String name){
        System.out.println("Name " + name);
        return DBManager.getInstance().addUser(new User(userId, sex, name));
    }

    /*
    @POST
    @Path("/{userId}")
    public Document addUser(){
        return null;
    } */
}
